home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 1 / Cream of the Crop 1.iso / PROGRAM / SPAWNO41.ARJ / SPAWNERR.ASM < prev    next >
Assembly Source File  |  1991-11-15  |  2KB  |  74 lines

  1. IFNDEF __TPINC
  2.     NAME    IOerror
  3.     TITLE    Convert DOS error numbers to C library error numbers
  4.     PAGE    60,132
  5.  
  6. ;-----------------------------------------------------------
  7. ; (c) Copyright 1991 Ralf Brown     All Rights Reserved
  8. ; This file may be redistributed as a part of the complete SPAWNO package,
  9. ; under its distribution conditions
  10. ;
  11. ;  SPAWNO v4.00
  12. ;    Overlaying spawnv()
  13. ;
  14. ;  File: SPAWNERR.ASM  Convert DOS error numbers to C library error numbers
  15. ;
  16. ;-----------------------------------------------------------
  17.  
  18.     INCLUDE RULES.ASI
  19.  
  20.     Header@
  21. ENDIF ;ndef __TPINC
  22.  
  23. ;-----------------------------------------------------------
  24. ; initialized data
  25.  
  26. DSeg@
  27. ExtSym@ _doserrno,WORD,__CDECL__
  28. ExtSym@ errno,WORD,__CDECL__
  29.  
  30. IFNDEF __TURBOC__
  31. error_numbers label byte
  32.     db    0
  33.     db    1
  34.     db    2    ; ENOENT
  35.     db    3
  36.     db    24    ; EMFILE
  37.     db    13    ; EACCESS
  38.     db    6
  39.     db    7
  40.     db    12    ; ENOMEM
  41. num_errors equ $-error_numbers
  42. ENDIF ;ndef __TURBOC__
  43.  
  44. DSegEnd@
  45.  
  46. CSeg@
  47.  
  48. ;----------------------------------------------------------------
  49. ; entry: AX = error number
  50. ;     DS = DGROUP
  51. ; exit:     errno and _doserrno set
  52. ;----------------------------------------------------------------
  53. public __SPAWN_ERRNO
  54. __SPAWN_ERRNO proc near
  55.     mov    DGROUP:_doserrno@,ax
  56. IFNDEF __TURBOC__
  57.     cmp    ax,num_errors
  58.     jae    translated
  59.     mov    bx,offset DGROUP:error_numbers
  60.     xlat
  61. translated:
  62. ENDIF ;ndef __TURBOC__
  63.     mov    DGROUP:errno@,ax
  64.     mov    ax,-1
  65.     ret
  66. __SPAWN_ERRNO endp
  67.  
  68. CSegEnd@
  69.  
  70. IFNDEF __TPINC
  71.     NOWARN OPI
  72.     END
  73. ENDIF
  74.